package com.cee.quartz.job;

import com.cee.enums.BaseEnum;
import com.cee.util.EnumUtil;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum TriggerState implements BaseEnum<String> {

    WAITING("WAITING", "Waiting"),
    PAUSED("PAUSED", "Paused"),
    ACQUIRED("ACQUIRED", "Acquired"),
    BLOCKED("BLOCKED", "Blocked"),
    ERROR("ERROR", "Error");


    private String code;
    private String text;

    private TriggerState(String code, String text) {
        this.code = code;
        this.text = text;
    }

    @Override
    public String getCode() {
        return code;
    }

    @JsonValue
    @Override
    public String getText() {
        return text;
    }

    @JsonCreator
    public static TriggerState createEnum(String code) {
        return EnumUtil.getEnumByCode(TriggerState.class, code);
    }

}
